package com.sky.mapper;

import com.sky.entity.AddressBook;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface AddressBookMapper {
    void add(AddressBook book);
    @Select("select * from address_book where user_id = #{userId}")
    List<AddressBook>getAlladresses(Long userId);
    @Update("update address_book set is_default = 1 where id = #{id}")
    void setdefault(Integer id);
    @Select("select * from address_book where id = #{id}")
    AddressBook getByid(Integer id);
    void update(AddressBook book);
    @Delete("delete from address_book where id = #{id}")
    void delete(Integer id);
}
